home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
strsed.zoo
/
check1.c
next >
Wrap
C/C++ Source or Header
|
1992-07-06
|
820b
|
46 lines
#include <stdio.h>
int
main()
{
/*
* Check simple searching.
*
* Input consists of sets of three lines containing
*
* text
* pattern
* expected new text
*
* See the file examples1
*
*/
extern int strcmp();
extern char *strsed();
char text[1024];
char pat[1024];
char ans[1024];
register char *result;
register int testno = 0;
int error = 0;
while (gets(text) && gets(pat) && gets(ans)){
testno++;
result = strsed(text, pat, 0);
if (strcmp(ans, result)){
error = 1;
printf("WARNING (test %d)... strsed(%s, %s) returns '%s'\nExpected '%s'\n",
testno, text, pat, result, ans);
fflush(stdout);
}
}
if (!error){
printf("Substitution and transliteration tests passed successfully.\n");
}
return 0;
}